var login = [SYS.base + '/' + SYS.ajax.login, 'http:///wforum.xbwbbs.com/logon.php', '/bbslogin.php', 'http://m.xbwbbs.com/user/login'],
home = ['/#!' + SYS.home.substr(1), 'http:///wforum.xbwbbs.com/index.php', '/frames.html', 'http://m.xbwbbs.com/'];
$(function(){
    $('#f_login').submit(function(){
	$.cookie('login-user', $('#id').val(),{path:'/', domain:SYS.cookie_domain,expires:30});
        var v = $('#s-mode').val();
        if(v == '0'){
            $.post(SYS.base + '/' + SYS.ajax.login, $(this).getPostData(), function(json){
                if(json.ajax_st == 1)
                    window.location.href = SYS.base + '/';
                else
                    DIALOG.ajaxDialog(json);

            }, 'json');
            return false;
        }
        $(this).attr('action', login[v]);
    });
    $('#b_guest').click(function(){
        var v = $('#s-mode').val();
	if(v == '0')
            window.location.href = SYS.base + home[$('#s-mode').val()];
        else
            window.location.href = home[$('#s-mode').val()];
    });
    $('#b_reg').click(function(){
        //window.location.href = SYS.base + "/#!reg";
	window.location.href="http://bbs.lzu.edu.cn/bbsreg0.html";
    });
    $('#b_reset').click(function(){
        window.location.href = SYS.base + "/#!reset";
    });
    $('#id, #pwd').placeholder().filter('#id').val($.cookie('login-user'));
    $($('#id').val() == ''?'#id':'#pwd').focus();
});
